<?php

/**
 * Attendance form base class.
 *
 * @method Attendance getObject() Returns the current form's model object
 *
 * @package    mysmartmanager
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BaseAttendanceForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'attendanceid' => new sfWidgetFormInputHidden(),
      'user_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Resource'), 'add_empty' => false)),
      'punch_type'   => new sfWidgetFormInputHidden(),
      'punch_time'   => new sfWidgetFormTime(),
    ));

    $this->setValidators(array(
      'attendanceid' => new sfValidatorDoctrineChoice(array('model' => $this->getModelName(), 'column' => 'attendanceid', 'required' => false)),
      'user_id'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Resource'), 'required' => false)),
      'punch_type'   => new sfValidatorBoolean(array('required' => false)),
      'punch_time'   => new sfValidatorDateTime(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('attendance[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Attendance';
  }

}
